< previous page page_348 next page >

Page 348
Listing 9.18. continued
    Dim strFLName As String
    Dim strMsg As String
    '
    ' init vars
    strDBName = App.Path & "\NewDB.mdb"
    strTDName = "NewTable"
    strFLName = "NewField"
    '
    ' build new database & table
    cmdCreateTable_Click
    '
    ' now open ws and db and td
    Set ws = DBEngine.Workspaces(0)
    Set db = ws.OpenDatabase(strDBName)
    '
    ' open table and get a field
    Set td = db.TableDefs(strTDName)
    Set fl = td.Fields(strFLName)
    '
    ' show properties of the field
    strMsg = ""
    For Each pr In fl.Properties
        strMsg = strMsg & pr.Name
        strMsg = strMsg & " = "
        strMsg = strMsg & pr.Value
        strMsg = strMsg & " {"
        strMsg = strMsg & ShowType(pr.Type) & "}"
        strMsg = strMsg & vbCrLf
    Next
    '
    MsgBox strMsg, vbInformation, "Fields"
    '
    ' cleanup
    db.Close
    ws.Close
    Set pr = Nothing
    Set fl = Nothing
    Set td = Nothing
    Set db = Nothing
    Set ws = Nothing
    '
    Exit Sub
    '
LocalErr:
    strMsg = strMsg & "<err>"
    Resume Next
    '
End Sub

 
< previous page page_348 next page >

If you like this book, buy it!